/**
 * Theme: Webadmin
 * Datatable
 */

!function ($) {
    "use strict";

    var DataTable = function () {
        this.$dataTableButtons = $("#datatable-buttons")
    };
    DataTable.prototype.createDataTableButtons = function () {
        0 !== this.$dataTableButtons.length && this.$dataTableButtons.DataTable({
            dom: "Bfrtip",
            lengthMenu: [
                [15, 30, 50, -1],
                ['15 条', '30 条', '50 条', '全部']
            ],
            buttons: [{
                extend: "copy",
                text: "复制",
                className: "btn-success"
            }, {
                extend: "pdf",
                text: "导出pdf"
            }, {
                extend: "print",
                text: "打印"
            },
                'pageLength'
            ],

            responsive: !0
        });
    },
        DataTable.prototype.init = function () {
            //creating demo tabels
            $('#datatable').dataTable();
            $('#datatable-keytable').DataTable({keys: true});
            $('#datatable-responsive').DataTable();
            $('#datatable-scroller').DataTable({
                ajax: "assets/plugins/datatables/json/scroller-demo.json",
                deferRender: true,
                scrollY: 380,
                scrollCollapse: true,
                scroller: true
            });
            var table = $('#datatable-fixed-header').DataTable({fixedHeader: true});

            //creating table with button
            this.createDataTableButtons();
        },
        //init
        $.DataTable = new DataTable, $.DataTable.Constructor = DataTable
}(window.jQuery),

//initializing
    function ($) {
        "use strict";
        $.DataTable.init();
    }(window.jQuery);